import 'package:json_annotation/json_annotation.dart';

part 'xmm_wall_user.g.dart';

@JsonSerializable()
class XmmWallUser {
  String? userId;
  String? nickname;
  String? avatar;
  String? avatarUrl;
  String? avatarMapPath;
  int? gender;
  int? age;
  String? country;
  String? status;
  int? callCoins;
  String? unit;
  List<String>? videoMapPaths;
  int? followNum;
  bool? isFriend;
  String? activityTagUrl;
  bool? isMultiple;
  String? about;
  int? grade;
  String? analysisLanguage;
  bool? isSignBroadcaster;
  int? showRoomVersion;
  int? broadcasterType;

  ///用户的本地数据作者名
  String? author;

  ///是否已关注
  bool? isFollow;

  ///是否已拉黑
  bool? isBlack;

  ///礼物数量
  int? giftNumber1;
  int? giftNumber2;
  int? giftNumber3;

  XmmWallUser({
    this.userId,
    this.nickname,
    this.avatar,
    this.avatarUrl,
    this.avatarMapPath,
    this.gender,
    this.age,
    this.country,
    this.status,
    this.callCoins,
    this.unit,
    this.videoMapPaths,
    this.followNum,
    this.isFriend,
    this.activityTagUrl,
    this.isMultiple,
    this.about,
    this.grade,
    this.analysisLanguage,
    this.isSignBroadcaster,
    this.showRoomVersion,
    this.broadcasterType,
    this.author,
    this.isFollow,
    this.isBlack,
    this.giftNumber1,
    this.giftNumber2,
    this.giftNumber3,
  });

  String get getAvatarUrl {
    if (avatarUrl != null && avatarUrl!.isNotEmpty) {
      return avatarUrl!;
    } else if (avatar != null && avatar!.isNotEmpty) {
      return avatar!;
    } else {
      return '';
    }
  }

  factory XmmWallUser.fromJson(Map<String, dynamic> json) =>
      _$XmmWallUserFromJson(json);

  Map<String, dynamic> toJson() => _$XmmWallUserToJson(this);
}
